/**
 * 在原型上添加公共方法
 * 知识点
 *      1、不能直接将checkName等方法添加到Function.prototype，这样会污染原生对象，
 *         别人创建的函数也会被污染
 */
Function.prototype.addMethod = function(name, fn) {
    this[name] = fn;
}

// var methods = function() {};//函数形式声明

var methods = new Function();//实例化一个类
var methodsCopy = new Function();

methods.addMethod('checkName', function() {
    console.log('checkName');
});

methods.addMethod('checkEmail', function() {
    console.log('checkEmail');
});

methods.addMethod('checkPsw', function() {
    console.log('checkPsw');
});

methods.checkPsw();

console.log(methods, methods.prototype);

console.log(methodsCopy.prototype);

console.log(Function.prototype);
